Open
Conversation
hundredblocks
suggested changes
Jan 28, 2019
Contributor
hundredblocks
left a comment
There was a problem hiding this comment.
Mostly minor comments. Only additional questions I have is:
- Have you tested that all prior endpoints still work (for images)
- Could you add an updated README to your PR that describes how to use the sentiment API?
| transfer the topless InceptionV3 model | ||
| to classify new classes | ||
| """ | ||
| print "Inside Transfer model" |
Contributor
There was a problem hiding this comment.
I don't think we need this. Seems like an artifact of your debugging :)
Collaborator
Author
There was a problem hiding this comment.
yes, I will remove this and other debugging related print statements
| batch_size = int(batch_size) | ||
|
|
||
|
|
||
| print "nb_val_samples:{}".format(nb_val_samples) |
Contributor
There was a problem hiding this comment.
I don't think we need this either, especially if we want to move to Python 3 down the line
|
|
||
| def __get_nb_files(self, directory): | ||
| """Get number of files by searching local dir recursively""" | ||
| logging.info("Inside __get_nb_files") |
|
|
||
|
|
||
| if textIDs: | ||
| print("* Predicting for {} of Models".format(len(textIDs.keys()))) |
Contributor
There was a problem hiding this comment.
We should either use print everywhere or logging everywhere (I vote logging)
| print("* Predicting for {} of Models".format(len(textIDs.keys()))) | ||
| print("* Number of Sentences: {}".format(num_text)) | ||
|
|
||
| r = {"positive":0.5, "negative":0.5} |
| INCEPTIONV3_IMAGE_QUEUE = app.config['INCEPTIONV3_IMAGE_QUEUE'] | ||
| INCEPTIONV3_TOPLESS_MODEL_PATH = app.config['INCEPTIONV3_TOPLESS_MODEL_PATH'] | ||
|
|
||
| SENTIMENT_TEXT_QUEUE = app.config['SENTIMENT_TEXT_QUEUE'] #Added by MS on 22-Jan-2019 |
Contributor
There was a problem hiding this comment.
I don't think you need that comment
| # init the transfer learning manager | ||
| this_IV3_transfer = inceptionV3_transfer_retraining.InceptionTransferLeaner(model_name) | ||
| new_model, label_dict, history = this_IV3_transfer.transfer_model(image_data_path, | ||
| print "Done loading model" |
Contributor
There was a problem hiding this comment.
log instead of pring
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added Flask blueprint to handle sentiment prediction request. Added sentiment server to read text from TEXT_QUEUE. Use as below -
curl -X POST
http://127.0.0.1:3031/sentimentV1/predict
-H 'Cache-Control: no-cache'
-H 'Postman-Token: eeedb319-2218-44b9-86eb-63a3a1f62e14'
-H 'content-type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW'
-F textv='the movie is good'
-F model_name=base